<?php
/**
 * Act as image. Displaying image according request mode
 *
 * @author Anggiajuang Patria <http://anggiaj.web.id/> 
 */

require_once 'config.php';
require_once 'functions.php';

if (isset($_GET['mode'])) {
	switch ($_GET['mode']) {
		// Standard Mode
		case 'standard':
			@session_start();
			
			$username 			= $_SESSION['username'];
			$domain 			= $_SESSION['domain'];
			$ext 				= $_SESSION['ext'];
			
			// Display email image
			display_email_image(create_standard_email_image($username, $domain, $ext));
			
			$_SESSION = array();
			@session_destroy();
			
			break;
		// Custom Mode
		case 'custom':
			
			@session_start();
			
			$email 			= $_SESSION['email'];
			$font_family	= FONT_PATH.$_SESSION['font_family'].'.ttf';
			$font_size 		= $_SESSION['font_size'];
			$color 			= $_SESSION['color'];
			$background 	= $_SESSION['background'];
			
			// Display email image
			display_email_image(create_custom_email_image($email, $font_family, $font_size, $color, $background));
			
			$_SESSION = array();
			@session_destroy();
			
			break;
	}
}
exit();
?>